objectdef BotBase
{
	variable int CurrentState = 0

	method E(string Text)
	{
		Echo "[${Time.Time24}] ${Text}"
	}

	method C(string Text)
	{
		UIElement[Output@Console@Pages@EQ Wanderbot]:Echo["[${Time.Time24}] ${Text}"]
		if ${Action.LogToFile}
		{
			LogDir:Open
			LogDir:SeekEnd[0]
			LogDir:Write["[${Time.Time24}] ${Text.Escape}\r\n"]
			LogDir:Close
		}
	}
	
	method EA(string Text)
	{
		This:E["[${This.ObjectName}: ${Text}]"]
	}

	method EC(string Text)
	{
		This:C["[${This.ObjectName}: ${Text}]"]
	}

	method Key(string key, string state, string static)
	{
		if ${key.Equal[static]}
		{
			if ${state.Equal[hold]}
			{
				press -hold "${static}"
			}
			elseif ${state.Equal[release]}
			{
				press -release "${static}"
			}
			else
			{
				press "${static}"
			}
		}
		else
		{
			if ${state.Equal[hold]}
			{
				press -hold "${${key}}"
			}
			elseif ${state.Equal[release]}
			{
				press -release "${${key}}"
			}
			else
			{
				press "${${key}}"
			}
		}
	}

	method ClearTarget()
	{
		This:Key["static","press","esc"]
	}
}